package com.taoym.voucher.xcx.controller;

import com.taoym.voucher.common.response.Response;
import com.taoym.voucher.xcx.entity.dto.XcxGetSearchDealsDTO;
import com.taoym.voucher.xcx.entity.dto.XcxGetSearchDealsShopDTO;
import com.taoym.voucher.xcx.entity.vo.XcxGetSearchDealsShopVO;
import com.taoym.voucher.xcx.entity.vo.XcxGetSearchDealsVO;
import com.taoym.voucher.xcx.service.XcxMtTuanDanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * @coder taoym
 * @datetime 2021/6/7 14:54
 * @desc 美团团单控制器
 */
@Api(tags = "美团团单")
@RestController
@RequestMapping("/meituan/tuandan")
public class XcxMtTuanDanController {

    @Autowired
    private XcxMtTuanDanService xcxMtTuanDanService;

    @ApiOperation("全国所有省份")
    @GetMapping("/provinces")
    public Response provinceAll() {
        return null;
    }

    @ApiOperation("省份下所有城市")
    @GetMapping("/cities")
    public Response provinceCities(@RequestParam @NotNull(message = "省份ID不能为空") Integer provinceId) {
        return null;
    }

    @ApiOperation("城市商品")
    @GetMapping("/categories")
    public Response<Map<String,String>> cityCategories(@RequestParam @NotNull(message = "城市ID不能为空") Integer cityId) {
        return Response.success(xcxMtTuanDanService.cityCategories(cityId));
    }

    @ApiOperation("查询商铺")
    @PostMapping("/shops")
    public Response<XcxGetSearchDealsShopVO> searchDealsShop(@RequestBody @Valid XcxGetSearchDealsShopDTO data) {
        return Response.success(xcxMtTuanDanService.searchDealsShop(data));
    }

    @ApiOperation("查询商铺下的优惠套餐")
    @GetMapping("/deals")
    public Response<XcxGetSearchDealsVO> searchDeals(@Valid XcxGetSearchDealsDTO data) {
        return Response.success(xcxMtTuanDanService.searchDeals(data));
    }
}
